﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ConsoleClient.MyGreetingService;
using ConsoleClient.WCFServiceReference;
using ConsoleClient.MyTicketService;

namespace ConsoleClient
{
    class Program
    {
        static void Main(string[] args)
        {
            #region Web Services
            // Add a service reference to the Web Service

            // Create a PROXY (object) for the actual service class

            //GreetingService proxy = new GreetingService();

            //int result = proxy.GetShippersCount();

            //Shipper[] allShippers = proxy.GetShippers();

            //foreach (Shipper shipper in allShippers)
            //{
            //    Console.WriteLine(shipper.CompanyName + "\t\t" + shipper.Phone);
            //}

            //proxy.Dispose();

            //using (var proxy = new Service2Client())
            //{
            //    string result = proxy.GreetByHour();
            //    Console.WriteLine("Result : " + result);
            //}
            #endregion

            using (var proxy = new TicketService())
            {
                do
                {
                    Console.Write("Enter number of tickets: ");
                    int quantity = int.Parse(Console.ReadLine());

                    bool result = proxy.BookTickets(quantity);
                    if (result == true)
                    {
                        Console.WriteLine("Tickets booked successfully");
                    }
                    else
                    {
                        Console.WriteLine("Insufficient tickets");
                    }
                    Console.WriteLine("\n\n");
                } while (true);
            }

            Console.ReadKey(true);
        }
    }
}
